package xyz.coolcsm.security.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import xyz.coolcsm.security.entity.SysRole;

import java.util.List;

/**
 * @author 什锦
 * @since 2021-06-1
 */
@Mapper
@Repository("roleMapper")
public interface RoleMapper extends BaseMapper<SysRole> {

    @Select("SELECT r.id, r.role_name roleName, r.role_description roleDesc " +
            "FROM sys_role r, sys_user ur " +
            "WHERE r.id=ur.id AND ur.id=#{uid}")
    public List<SysRole> findByUid(Integer uid);

}
